***This is the main do-file for replicating the analysis appearing in

***Arndt, C, Jensen, C. and Wenzelburger, G(2020): Voters’ Wrath? Policy change and government popularity - accepted for publication in Governance

***These commands produce the Tables and Figures for the empirical analysis appearing the main text, the names of the drives and folders might obviously be different on your computer/device
***please use the dataset "Policy_data_PB_timeseries_all_11April" since it contains all precoded variables and the macro-level data on reforms
***please also read all comments and remarks below careful as we saved some of the results in new files to create Figure 3 and Figure 6


***These are the vote shares and significance tests of government support after cutbacks and expansions presented in the beginning of section 6.1
tab p_lnumexp, gen(pensionexp_dummy_)
tab p_lnumcut, gen(pensioncut_dummy_)
tab ub_lnumex, gen(ubexp_dummy_)
tab ub_lnumcut, gen(ubcut_dummy_)

proportion govparty , over(pensionexp_dummy_1)
proportion govparty , over(pensioncut_dummy_1)
proportion govparty , over(ubexp_dummy_1)
proportion govparty , over(ubcut_dummy_1)

*T-Tests difference for month with one expansion resp cutback vs no reform (grand mean) 
ttest govparty, by(pensionexp_dummy_1)
ttest govparty, by(pensioncut_dummy_1)

ttest govparty, by(ubexp_dummy_1)
ttest govparty, by(ubcut_dummy_1)



***Different variant of T-test: all months that have at least one event against months without any event

*variable that captures whether reform events are non-zero and then classifies by expansion and cutback
gen     pension_exp_cut=0 if p_lnumexp>0
replace pension_exp_cut=1 if p_lnumcut>0

lab def expcut 0 "expansion" 1 "cut"
lab val pension_exp_cut expcut

gen     ub_exp_cut=0 if ub_lnumexp>0
replace ub_exp_cut=1 if ub_lnumcut>0

lab val ub_exp_cut expcut

*T-Test pensions
ttest govparty, by(pension_exp_cut)

*T-Test unemployment
ttest govparty, by(ub_exp_cut)






**********************************************************************************************
*Table 3: Main Effects of pension reforms
*these commands produce the coefficients in Table 3, the full models are reported in the appendix
*the order of the commands indicate the order in Table 3 from left to right
**********************************************************************************************


*baseline, w/o controls
mlogit defection lag1_p_lnumexp lag1_p_lnumcut, robust

*baseline, with macro
mlogit defection lag1_p_lnumexp lag1_p_lnumcut d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust

*baseline, with macro and micro
mlogit defection lag1_p_lnumexp lag1_p_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust

*with interaction reforms*age cohort
mlogit defection c.lag1_p_lnumexp##i.age c.lag1_p_lnumcut##i.age class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust

*with interaction reforms*special event
mlogit defection i.singleevent##c.lag1_p_lnumexp i.singleevent##c.lag1_p_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost i.gov_comp, robust

*dummy: government vs opposition, very-right column of Table 3, full model with explanation appears in Table B9
mlogit govparty lag1_p_lnumexp lag1_p_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust base(1)


**********************************************************************************************
*Table 4: Main Effects of labour market reforms
*these commands produce the coefficients in Table 4, the full models are reported in the appendix
*the order of the commands indicate the order in Table 4 from left to right
**********************************************************************************************

*baseline, w/o controls
mlogit defection lag1_ub_lnumexp lag1_ub_lnumcut, robust

*baseline, with macro
mlogit defection lag1_ub_lnumexp lag1_ub_lnumcut d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust

*baseline, with macro and micro
mlogit defection lag1_ub_lnumexp lag1_ub_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust 

*with interaction reforms*unemployment rate month before
mlogit defection c.lag1_ub_lnumexp##c.d1_unemp_month c.lag1_ub_lnumcut##c.d1_unemp_month class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion lag1_gdp_q cost singleevent i.gov_comp, robust

*with interaction reforms*special event
mlogit defection i.singleevent##c.lag1_ub_lnumexp i.singleevent##c.lag1_ub_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost i.gov_comp, robust

*dummy: government vs opposition, full model with explanation appears in Table B10
mlogit govparty lag1_ub_lnumexp lag1_ub_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust base(1)




**********************************************************************************************
*Pension reforms, predicted probabilities for Figure 2
**********************************************************************************************
***baseline pensions, larger reforms
mlogit defection lag1_p_lnumexp lag1_p_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust
outreg2 using "F:\WSCEP\Governance Paper with PB data\pensions_base_V13.doc", alpha(0.001, 0.01, 0.05) e(ll df_m chi2) word replace


*one graph for expansions
margins, at(lag1_p_lnumexp=(0(1)3) lag1_p_lnumcut=0 ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 gov_comp=1) pr(outcome(1)) pr(outcome(3))

*color
marginsplot, ///
ytitle("Probability of switching, %", axis(1) size(medium) height(5)) ///
xtitle("Number of expansions in month before", size(medium) color(black) height(5)) ///
ylabel(0 "0" .1 "10" .2 "20" .3 "30", angle (0) labsize(medium)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
title("", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(red) fintensity(60)) ci2opts(color(ltblue)) ///
plot1opts(lcolor(cranberry) mcolor(cranberry) msymbol(square)) plot2opts(lcolor(blue) mcolor(blue) msymbol(triangle)) ///
unique name("p_lnumexp_govdef_n", replace)

*bw
marginsplot, ///
ytitle("Probability of switching, %", axis(1) size(medium) height(5)) ///
xtitle("Number of expansions in month before", size(medium) color(black) height(5)) ///
ylabel(0 "0" .05 "5" .1 "10" .15 "15" .2 "20", angle (0) labsize(medium)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
title("", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(gs4) fintensity(60)) ci2opts(color(gs12)) ///
plot1opts(lcolor(black) mcolor(black) msymbol(square)) plot2opts(lcolor(gs8) lpattern(dash) mcolor(gs8) msymbol(triangle)) ///
unique name("p_lnumexp_govdef_n_bw", replace)


*one graph for cuts
margins, at(lag1_p_lnumexp=0 lag1_p_lnumcut=(0(1)3) ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 gov_comp=1) pr(outcome(1)) pr(outcome(3))

*color
marginsplot, ///
ytitle("Probability of switching, %", axis(1) size(medium) height(5)) ///
xtitle("Number of cutbacks in month before", size(medium) color(black) height(5)) ///
ylabel(0 "0" .1 "10" .2 "20" .3 "30", angle (0) labsize(medium)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
title("", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(red) fintensity(60)) ci2opts(color(ltblue)) ///
plot1opts(lcolor(cranberry) mcolor(cranberry) msymbol(square)) plot2opts(lcolor(blue) mcolor(blue) msymbol(triangle)) ///
unique name("p_lnumcut_govdef_n", replace)

*bw
marginsplot, ///
ytitle("Probability of switching, %", axis(1) size(medium) height(5)) ///
xtitle("Number of cutbacks in month before", size(medium) color(black) height(5)) ///
ylabel(0 "0" .05 "5" .1 "10" .15 "15" .2 "20", angle (0) labsize(medium)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
title("", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(gs4) fintensity(60)) ci2opts(color(gs12)) ///
plot1opts(lcolor(black) mcolor(black) msymbol(square)) plot2opts(lcolor(gs8) lpattern(dash) mcolor(gs8) msymbol(triangle)) ///
unique name("p_lnumcut_govdef_n_bw", replace)


*Figure 2, upper panel
grc1leg p_lnumexp_govdef_n p_lnumcut_govdef_n, graphregion(color(white)) ycommon
grc1leg p_lnumexp_govdef_n_bw p_lnumcut_govdef_n_bw, graphregion(color(white)) ycommon

*for combination
grc1leg p_lnumexp_govdef_n_bw p_lnumcut_govdef_n_bw, graphregion(color(white)) ycommon ///
title("Pensions", size(medium) color(black)) name("p_base_bw", replace)


*for combination with different specifications of dv
grc1leg p_lnumexp_govdef_n_bw p_lnumcut_govdef_n_bw, graphregion(color(white)) ycommon ///
title("Baseline Specification", size(medium) color(black)) name("p_base2_bw", replace)



**********************************************************************************************
*Labour market reforms, predicted probabilities for Figure 2
**********************************************************************************************

*baseline unemp benefits, larger reforms
mlogit defection lag1_ub_lnumexp lag1_ub_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust
outreg2 using "F:\WSCEP\Governance Paper with PB data\ub_base_V13.doc", alpha(0.001, 0.01, 0.05) e(ll df_m chi2) word replace

*one graph for expansions
margins, at(lag1_ub_lnumexp=(0(1)3) lag1_ub_lnumcut=0 ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 gov_comp=1) pr(outcome(1)) pr(outcome(3))

*color
marginsplot, ///
ytitle("Probability of switching, %", axis(1) size(medium) height(5)) ///
xtitle("Number of expansions in month before", size(medium) color(black) height(5)) ///
ylabel(0 "0" .05 "5" .1 "10" .15 "15" .20 "20" .25 "25", angle (0) labsize(medium)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
title("", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(red) fintensity(60)) ci2opts(color(ltblue)) ///
plot1opts(lcolor(cranberry) mcolor(cranberry) msymbol(square)) plot2opts(lcolor(blue) mcolor(blue) msymbol(triangle)) ///
unique name("ub_lnumexp_govdef_n", replace)

*bw
marginsplot, ///
ytitle("Probability of switching, %", axis(1) size(medium) height(5)) ///
xtitle("Number of expansions in month before", size(medium) color(black) height(5)) ///
ylabel(0 "0" .05 "5" .1 "10" .15 "15" .20 "20", angle (0) labsize(medium)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
title("", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(gs4) fintensity(60)) ci2opts(color(gs12)) ///
plot1opts(lcolor(black) mcolor(black) msymbol(square)) plot2opts(lcolor(gs8) lpattern(dash) mcolor(gs8) msymbol(triangle)) ///
unique name("ub_lnumexp_govdef_n_bw", replace)


*one graph for cuts
margins, at(lag1_ub_lnumexp=0 lag1_ub_lnumcut=(0(1)3)  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 gov_comp=1) pr(outcome(1)) pr(outcome(3))

*color
marginsplot, ///
ytitle("Probability of switching, %", axis(1) size(medium) height(5)) ///
xtitle("Number of cutbacks in month before", size(medium) color(black) height(5)) ///
ylabel(0 "0" .05 "5" .1 "10" .15 "15" .20 "20" .25 "25", angle (0) labsize(medium)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
title("", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(red) fintensity(60)) ci2opts(color(ltblue)) ///
plot1opts(lcolor(cranberry) mcolor(cranberry) msymbol(square)) plot2opts(lcolor(blue) mcolor(blue) msymbol(triangle)) ///
unique name("ub_lnumcut_govdef_n", replace)

*bw
marginsplot, ///
ytitle("Probability of switching, %", axis(1) size(medium) height(5)) ///
xtitle("Number of cutbacks in month before", size(medium) color(black) height(5)) ///
ylabel(0 "0" .05 "5" .1 "10" .15 "15" .20 "20", angle (0) labsize(medium)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
title("", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(gs4) fintensity(60)) ci2opts(color(gs12)) ///
plot1opts(lcolor(black) mcolor(black) msymbol(square)) plot2opts(lcolor(gs8) lpattern(dash) mcolor(gs8) msymbol(triangle)) ///
unique name("ub_lnumcut_govdef_n_bw", replace)

*Figure 2 lower panel
grc1leg ub_lnumexp_govdef_n ub_lnumcut_govdef_n, graphregion(color(white)) ycommon
grc1leg ub_lnumexp_govdef_n_bw ub_lnumcut_govdef_n_bw, graphregion(color(white)) ycommon

*for combination
grc1leg ub_lnumexp_govdef_n_bw ub_lnumcut_govdef_n_bw, graphregion(color(white)) ycommon ///
title("Unemployment insurance", size(medium) color(black)) name("ub_base_bw", replace)

*Combined Figure 2
grc1leg p_base_bw ub_base_bw, graphregion(color(white)) ycommon cols(1)
graph display, xsize(5.5) ysize(7.5)
graph save Graph "F:\WSCEP\Politbarometer kumuliert for WSECP\Figure 2.gph", replace

graph save Graph "F:\WSCEP\Governance Paper with PB data\Final Version Governance\Figure 2.gph", replace
graph export "F:\WSCEP\Governance Paper with PB data\Final Version Governance\Figure 2.tif", replace width(1200)


********************************************************************************************************************************
*Pension reforms, persistence of effects over time, the margins are presented in Figure 3
*Note: the margins had been saved in a new STATA file 
*"F:\WSCEP\Governance Paper with PB data\differences margins_month_Governance.dta" based on the log file
*to create Figure 3, use this data and run the do-file "differences margins_month_Governance" to create Figure 3
********************************************************************************************************************************

log using "F:\WSCEP\Governance Paper with PB data\timing_margins.smcl", replace

***baseline pensions, 1 month
mlogit defection lag1_p_lnumexp lag1_p_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust

*margins
margins, dydx(lag1_p_lnumexp) at(lag1_p_lnumcut=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=24 gov_comp=1) pr(outcome(1)) pr(outcome(3))

margins, dydx(lag1_p_lnumcut) at(lag1_p_lnumexp=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=24 gov_comp=1) pr(outcome(1)) pr(outcome(3))


***baseline pensions, 2 months
mlogit defection lag2_p_lnumexp lag2_p_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust

*margins
margins, dydx(lag2_p_lnumexp) at(lag2_p_lnumcut=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=25 gov_comp=1) pr(outcome(1)) pr(outcome(3))

margins, dydx(lag2_p_lnumcut) at(lag2_p_lnumexp=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=25 gov_comp=1) pr(outcome(1)) pr(outcome(3))


***baseline pensions, 3 months
mlogit defection lag3_p_lnumexp lag3_p_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust
outreg2 lag3_p_lnumexp lag3_p_lnumcut  using "H:\WSCEP\Politbarometer kumuliert for WSECP\pensions_time.doc", alpha(0.001, 0.01, 0.05) e(ll df_m chi2) word append

*margins
margins, dydx(lag3_p_lnumexp) at(lag3_p_lnumcut=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=26 gov_comp=1) pr(outcome(1)) pr(outcome(3))

margins, dydx(lag3_p_lnumcut) at(lag3_p_lnumexp=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=26 gov_comp=1) pr(outcome(1)) pr(outcome(3))


***baseline pensions, 4 months
mlogit defection lag4_p_lnumexp lag4_p_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust
*outreg2 using "H:\WSCEP\Politbarometer kumuliert for WSECP\pensions_base.doc", alpha(0.001, 0.01, 0.05) e(ll df_m chi2) word replace

*margins
margins, dydx(lag4_p_lnumexp) at(lag4_p_lnumcut=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=27 gov_comp=1) pr(outcome(1)) pr(outcome(3))

margins, dydx(lag4_p_lnumcut) at(lag4_p_lnumexp=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=27 gov_comp=1) pr(outcome(1)) pr(outcome(3))


***baseline pensions, 5 months
mlogit defection lag5_p_lnumexp lag5_p_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust
*outreg2 using "H:\WSCEP\Politbarometer kumuliert for WSECP\pensions_base.doc", alpha(0.001, 0.01, 0.05) e(ll df_m chi2) word replace

*margins
margins, dydx(lag5_p_lnumexp) at(lag5_p_lnumcut=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=28 gov_comp=1) pr(outcome(1)) pr(outcome(3))


margins, dydx(lag5_p_lnumcut) at(lag5_p_lnumexp=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=28 gov_comp=1) pr(outcome(1)) pr(outcome(3))


***baseline pensions, 6 months
mlogit defection lag6_p_lnumexp lag6_p_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust
*outreg2 using "H:\WSCEP\Politbarometer kumuliert for WSECP\pensions_base.doc", alpha(0.001, 0.01, 0.05) e(ll df_m chi2) word replace

*margins
margins, dydx(lag6_p_lnumexp) at(lag6_p_lnumcut=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=29 gov_comp=1) pr(outcome(1)) pr(outcome(3))

margins, dydx(lag6_p_lnumcut) at(lag6_p_lnumexp=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=29 gov_comp=1) pr(outcome(1)) pr(outcome(3))


***********************************************************************************************
*Labour market reforms, persistence of effects over time, the margins are presented in Figure 3
***********************************************************************************************
***baseline pensions, 1 month
mlogit defection lag1_ub_lnumexp lag1_ub_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust

*margins
margins, dydx(lag1_ub_lnumexp) at(lag1_ub_lnumcut=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=24 gov_comp=1) pr(outcome(1)) pr(outcome(3))

margins, dydx(lag1_ub_lnumcut) at(lag1_ub_lnumexp=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=24 gov_comp=1) pr(outcome(1)) pr(outcome(3))


***baseline pensions, 2 months
mlogit defection lag2_ub_lnumexp lag2_ub_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust

*margins
margins, dydx(lag2_ub_lnumexp) at(lag2_ub_lnumcut=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=25 gov_comp=1) pr(outcome(1)) pr(outcome(3))

margins, dydx(lag2_ub_lnumcut) at(lag2_ub_lnumexp=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=25 gov_comp=1) pr(outcome(1)) pr(outcome(3))


***baseline pensions, 3 months
mlogit defection lag3_ub_lnumexp lag3_ub_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust
*outreg2 using "H:\WSCEP\Politbarometer kumuliert for WSECP\pensions_base.doc", alpha(0.001, 0.01, 0.05) e(ll df_m chi2) word replace

*margins
margins, dydx(lag3_ub_lnumexp) at(lag3_ub_lnumcut=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=26 gov_comp=1) pr(outcome(1)) pr(outcome(3))

margins, dydx(lag3_ub_lnumcut) at(lag3_ub_lnumexp=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=26 gov_comp=1) pr(outcome(1)) pr(outcome(3))


***baseline pensions, 4 months
mlogit defection lag4_ub_lnumexp lag4_ub_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust
*outreg2 using "H:\WSCEP\Politbarometer kumuliert for WSECP\pensions_base.doc", alpha(0.001, 0.01, 0.05) e(ll df_m chi2) word replace

*margins
margins, dydx(lag4_ub_lnumexp) at(lag4_ub_lnumcut=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=27 gov_comp=1) pr(outcome(1)) pr(outcome(3))

margins, dydx(lag4_ub_lnumcut) at(lag4_ub_lnumexp=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=27 gov_comp=1) pr(outcome(1)) pr(outcome(3))


***baseline pensions, 5 months
mlogit defection lag5_ub_lnumexp lag5_ub_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust
*outreg2 using "H:\WSCEP\Politbarometer kumuliert for WSECP\pensions_base.doc", alpha(0.001, 0.01, 0.05) e(ll df_m chi2) word replace

*margins
margins, dydx(lag5_ub_lnumexp) at(lag5_ub_lnumcut=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=28 gov_comp=1) pr(outcome(1)) pr(outcome(3))

margins, dydx(lag5_ub_lnumcut) at(lag5_ub_lnumexp=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=28 gov_comp=1) pr(outcome(1)) pr(outcome(3))


***baseline pensions, 6 months
mlogit defection lag6_ub_lnumexp lag6_ub_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust
*outreg2 using "H:\WSCEP\Politbarometer kumuliert for WSECP\pensions_base.doc", alpha(0.001, 0.01, 0.05) e(ll df_m chi2) word replace

*margins
margins, dydx(lag6_ub_lnumexp) at(lag6_ub_lnumcut=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=29 gov_comp=1) pr(outcome(1)) pr(outcome(3))

margins, dydx(lag6_ub_lnumcut) at(lag6_ub_lnumexp=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 cost=29 gov_comp=1) pr(outcome(1)) pr(outcome(3))

log cl


*********************************************************************************************************
*Pension reforms, interaction with age groups for Figure 4
*********************************************************************************************************
mlogit defection c.lag1_p_lnumexp##i.age c.lag1_p_lnumcut##i.age class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost singleevent i.gov_comp, robust
outreg2 using "F:\WSCEP\Governance Paper with PB data\pensions_age_V13.doc", alpha(0.001, 0.01, 0.05) e(ll df_m chi2) word replace

*margins for expansions
margins, over(age) dydx(lag1_p_lnumexp) at(lag1_p_lnumcut=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 gov_comp=1) pr(outcome(1)) pr(outcome(3))

*color
marginsplot, ///
ytitle("", axis(1) size(medium) height(15)) ///
xtitle("Age groups", size(medium) color(black) height(5)) ///
ylabel(-.03 "-3" -.02 "-2" -.01 "-1" .0 "0" .01 "1" .02 "2", angle (0) labsize(medium)) ///
yline(0, lcolor(black)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
xlabel(1 "18-29" 2 "30-44" 3 "45-59" 4 "60+", angle(0)) ///
title("Expansions", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(scatter) ci1opts(color(cranberry)) ci2opts(color(blue)) ///
plot1opts(lcolor(cranberry) mcolor(cranberry) msymbol(diamond)) plot2opts(lcolor(blue) mcolor(blue) msymbol(triangle)) ///
unique name("p_intagelnumexp_dx", replace)

*bw
marginsplot, ///
ytitle("", axis(1) size(medium) height(15)) ///
xtitle("Age groups", size(medium) color(black) height(5)) ///
ylabel(-.03 "-3" -.02 "-2" -.01 "-1" .0 "0" .01 "1" .02 "2", angle (0) labsize(medium)) ///
yline(0, lcolor(black)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
xlabel(1 "18-29" 2 "30-44" 3 "45-59" 4 "60+", angle(0)) ///
title("Expansions", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(scatter) ci1opts(color(gs4)) ci2opts(color(gs12)) ///
plot1opts(lcolor(black) mcolor(black) msymbol(diamond)) plot2opts(lcolor(gs8) mcolor(gs8) msymbol(triangle)) ///
unique name("p_intagelnumexp_dx_bw", replace)


*margins for cuts
margins, over(age) dydx(lag1_p_lnumcut) at(lag1_p_lnumexp=0  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 gov_comp=1) pr(outcome(1)) pr(outcome(3))

*color
marginsplot, ///
ytitle("", axis(1) size(medium) height(15)) ///
xtitle("Age groups", size(medium) color(black) height(5)) ///
ylabel(-.03 "-3" -.02 "-2" -.01 "-1" .0 "0" .01 "1" .02 "2", angle (0) labsize(medium)) ///
yline(0, lcolor(black)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
xlabel(1 "18-29" 2 "30-44" 3 "45-59" 4 "60+", angle(0)) ///
title("Cutbacks", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(scatter) ci1opts(color(cranberry)) ci2opts(color(blue)) ///
plot1opts(lcolor(cranberry) mcolor(cranberry) msymbol(diamond)) plot2opts(lcolor(blue) mcolor(blue) msymbol(triangle)) ///
unique name("p_intagelnumcut_dx", replace)

*bw
marginsplot, ///
ytitle("", axis(1) size(medium) height(15)) ///
xtitle("Age groups", size(medium) color(black) height(5)) ///
ylabel(-.03 "-3" -.02 "-2" -.01 "-1" .0 "0" .01 "1" .02 "2", angle (0) labsize(medium)) ///
yline(0, lcolor(black)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
xlabel(1 "18-29" 2 "30-44" 3 "45-59" 4 "60+", angle(0)) ///
title("Cutbacks", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(scatter) ci1opts(color(gs4)) ci2opts(color(gs12)) ///
plot1opts(lcolor(black) mcolor(black) msymbol(diamond)) plot2opts(lcolor(gs8) mcolor(gs8) msymbol(triangle)) ///
unique name("p_intagelnumcut_dx_bw", replace)


*Figure 4
grc1leg p_intagelnumexp_dx p_intagelnumcut_dx, graphregion(color(white)) ycommon
grc1leg p_intagelnumexp_dx_bw p_intagelnumcut_dx_bw, graphregion(color(white)) ycommon

graph save Graph "F:\WSCEP\Governance Paper with PB data\Figure 4 pension_age.gph", replace
graph save Graph "F:\WSCEP\Governance Paper with PB data\Final Version Governance\Figure 4.gph", replace
graph export "F:\WSCEP\Governance Paper with PB data\Final Version Governance\Figure 4.tif", replace width(1200)



******************************************************************************************
*Large labour market reforms, interaction with change of unemployment rate for Figure 5
******************************************************************************************
mlogit defection c.lag1_ub_lnumexp##c.d1_unemp_month c.lag1_ub_lnumcut##c.d1_unemp_month class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion lag1_gdp_q cost singleevent i.gov_comp, robust
outreg2 using "F:\WSCEP\Governance Paper with PB data\ub_uerate_V13.doc", alpha(0.001, 0.01, 0.05) e(ll df_m chi2) word replace

*margins for expansions
margins, dydx(lag1_ub_lnumexp) at(lag1_ub_lnumcut=0 d1_unemp_month=(-1(.1)1.7)  ///
age=3 occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 gov_comp=1) pr(outcome(1)) pr(outcome(3))

*color
marginsplot, ///
ytitle("", axis(1) size(medium) height(15)) ///
xtitle("Change in unemployment rate month before", size(medium) color(black) height(5)) ///
ylabel(-.02 "-2" -.01 "-1" .0 "0" .01 "1" .02 "2", angle (0) labsize(medium)) ///
yline(0, lcolor(black)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
xlabel(-1 "-1" -.5 "-0.5" 0 "0" .5 "0.5" 1 "1" 1.5 "1.5" 1.7 "1.7", angle(0)) ///
title("Expansions", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(red) fintensity(60)) ci2opts(color(ltblue)) ///
plot1opts(lcolor(cranberry)) plot2opts(lcolor(blue)) ///
unique name("ub_intlnumcut_uerate_A", replace)

*bw
marginsplot, ///
ytitle("", axis(1) size(medium) height(15)) ///
xtitle("Change in unemployment rate month before", size(medium) color(black) height(5)) ///
ylabel(-.02 "-2" -.01 "-1" .0 "0" .01 "1" .02 "2", angle (0) labsize(medium)) ///
yline(0, lcolor(black)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
xlabel(-1 "-1" -.5 "-0.5" 0 "0" .5 "0.5" 1 "1" 1.5 "1.5" 1.7 "1.7", angle(0)) ///
title("Expansions", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(gs4) fintensity(60)) ci2opts(color(gs12)) ///
plot1opts(lcolor(black)) plot2opts(lcolor(gs8) lpattern(dash)) ///
unique name("ub_intlnumcut_uerate_A_bw", replace)


*margins for cuts
margins, dydx(lag1_ub_lnumcut) at(lag1_ub_lnumexp=0 d1_unemp_month=(-1(.1)1.7)  ///
age=3 occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 sex=0 edu_1=0 edu_2=0 religion=2 singleevent=0 gov_comp=1) pr(outcome(1)) pr(outcome(3))

*color
marginsplot, ///
ytitle("", axis(1) size(medium) height(15)) ///
xtitle("Change in unemployment rate month before", size(medium) color(black) height(5)) ///
ylabel(-.02 "-2" -.01 "-1" .0 "0" .01 "1" .02 "2", angle (0) labsize(medium)) ///
yline(0, lcolor(black)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
xlabel(-1 "-1" -.5 "-0.5" 0 "0" .5 "0.5" 1 "1" 1.5 "1.5" 1.7 "1.7", angle(0)) ///
title("Cutbacks", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(red) fintensity(60)) ci2opts(color(ltblue)) ///
plot1opts(lcolor(cranberry)) plot2opts(lcolor(blue)) ///
unique name("ub_intlnumcut_uerate_B", replace)

*bw
marginsplot, ///
ytitle("", axis(1) size(medium) height(15)) ///
xtitle("Change in unemployment rate month before", size(medium) color(black) height(5)) ///
ylabel(-.02 "-2" -.01 "-1" .0 "0" .01 "1" .02 "2", angle (0) labsize(medium)) ///
yline(0, lcolor(black)) ///
legend(order(3 "Defector" 4 "Rewarder")) ///
xlabel(-1 "-1" -.5 "-0.5" 0 "0" .5 "0.5" 1 "1" 1.5 "1.5" 1.7 "1.7", angle(0)) ///
title("Cutbacks", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(gs4) fintensity(60)) ci2opts(color(gs12)) ///
plot1opts(lcolor(black)) plot2opts(lcolor(gs8) lpattern(dash)) ///
unique name("ub_intlnumcut_uerate_B_bw", replace)


*Figure 5
grc1leg ub_intlnumcut_uerate_A ub_intlnumcut_uerate_B, ycommon graphregion(color(white))
grc1leg ub_intlnumcut_uerate_A_bw ub_intlnumcut_uerate_B_bw, ycommon graphregion(color(white))

graph save Graph "F:\WSCEP\Governance Paper with PB data\Figure 5 ub_uerate.gph", replace
graph save Graph "F:\WSCEP\Governance Paper with PB data\Final Version Governance\Figure 5.gph", replace
graph export "F:\WSCEP\Governance Paper with PB data\Final Version Governance\Figure 5.tif", replace width(1200)



*************************************************************************************************
*Pension reform effects over Single Events: the margins were saved manually in Excel and then stored in 
*the file F:\WSCEP\Governance Paper with PB data\differences special events.dta to create the Figure 6 based on the special event models
*please run the commands in the separate do-file "differences pred_prob_events_Governance" on this data
*************************************************************************************************



***baseline pensions with single events, larger reforms
mlogit defection i.singleevent##c.lag1_p_lnumexp i.singleevent##c.lag1_p_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost i.gov_comp, robust
outreg2 using "F:\WSCEP\Governance Paper with PB data\pensions_event_V13.doc", alpha(0.001, 0.01, 0.05) e(ll df_m chi2) word replace

*expansions
margins, over(singleevent) at(lag1_p_lnumexp=(0(1)5) lag1_p_lnumcut=0 ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 gov_comp=1) pr(outcome(1)) pr(outcome(3))

marginsplot, ///
ytitle("Probability of switching, %", axis(1) size(medium) height(5)) ///
xtitle("Number of expansions in month before", size(medium) color(black) height(5)) ///
ylabel(0 "0" .1 "10" .2 "20" .3 "30", angle (0) labsize(medium)) ///
legend(order(5 "Defector: no single event" 6 "Rewarder: no single event" 7 "Defector: single event" 8 "Rewarder: single event")) ///
title("Expansions", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(red) fintensity(60)) ci3opts(color(dkorange)) ///
ci2opts(color(ebblue)) ci4opts(color(lime)) ///
plot1opts(lcolor(cranberry)) plot3opts(lcolor(orange) lpattern(longdash_dot)) plot2opts(lcolor(blue)) plot4opts(lcolor(midgreen) lpattern(dash_dot)) ///
unique name("p_lnumexp_govdef_event", replace)


*cuts
margins, over(singleevent) at(lag1_p_lnumexp=0 lag1_p_lnumcut=(0(1)5) ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 gov_comp=1) pr(outcome(1)) pr(outcome(3))

marginsplot, ///
ytitle("Probability of switching, %", axis(1) size(medium) height(5)) ///
xtitle("Number of cutbacks in month before", size(medium) color(black) height(5)) ///
ylabel(0 "0" .1 "10" .2 "20" .3 "30", angle (0) labsize(medium)) ///
legend(order(5 "Defector: no single event" 6 "Rewarder: no single event" 7 "Defector: single event" 8 "Rewarder: single event")) ///
title("Cuts", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(red) fintensity(60)) ci3opts(color(dkorange)) ///
ci2opts(color(ebblue)) ci4opts(color(lime)) ///
plot1opts(lcolor(cranberry)) plot3opts(lcolor(orange) lpattern(longdash_dot)) plot2opts(lcolor(blue)) plot4opts(lcolor(midgreen) lpattern(dash_dot)) ///
unique name("p_lnumcut_govdef_event", replace)


*************************************************************************************************
*Labour market reform effects over Single Events
*************************************************************************************************
***baseline unemp benefits with single events, larger reforms
mlogit defection i.singleevent##c.lag1_ub_lnumexp i.singleevent##c.lag1_ub_lnumcut class_2 class_3 class_4 class_5 class_6 occ_2 occ_3 occ_4 occ_6 unionv74 i.age sex edu_1 edu_2 i.religion d1_unemp_month lag1_gdp_q cost i.gov_comp, robust
outreg2 using "F:\WSCEP\Governance Paper with PB data\ub_event_V13.doc", alpha(0.001, 0.01, 0.05) e(ll df_m chi2) word replace

*expansions
margins, over(singleevent) at(lag1_ub_lnumexp=(0(1)5) lag1_ub_lnumcut=0 ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 gov_comp=1) pr(outcome(1)) pr(outcome(3))

marginsplot, ///
ytitle("Probability of switching, %", axis(1) size(medium) height(5)) ///
xtitle("Number of expansions in month before", size(medium) color(black) height(5)) ///
ylabel(0 "0" .1 "10" .2 "20" .3 "30" .4 "40", angle (0) labsize(medium)) ///
legend(order(5 "Defector: no single event" 6 "Rewarder: no single event" 7 "Defector: single event" 8 "Rewarder: single event")) ///
title("Expansions", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(red) fintensity(60)) ci3opts(color(dkorange)) ///
ci2opts(color(ebblue)) ci4opts(color(lime)) ///
plot1opts(lcolor(cranberry)) plot3opts(lcolor(orange) lpattern(longdash_dot)) plot2opts(lcolor(blue)) plot4opts(lcolor(midgreen) lpattern(dash_dot)) ///
unique name("ub_lnumexp_govdef_event", replace)


*cuts
margins, over(singleevent) at(lag1_ub_lnumexp=0 lag1_ub_lnumcut=(0(1)5)  ///
class_2=1 class_3=0 class_4=0 class_5=0 class_6=0 ///
occ_2=0 occ_3=0 occ_4=0 occ_6=0 unionv74=0 age=2 sex=0 edu_1=0 edu_2=0 religion=2 gov_comp=1) pr(outcome(1)) pr(outcome(3))

marginsplot, ///
ytitle("Probability of switching, %", axis(1) size(medium) height(5)) ///
xtitle("Number of cutbacks in month before", size(medium) color(black) height(5)) ///
ylabel(0 "0" .1 "10" .2 "20" .3 "30" .4 "40", angle (0) labsize(medium)) ///
legend(order(5 "Defector: no single event" 6 "Rewarder: no single event" 7 "Defector: single event" 8 "Rewarder: single event")) ///
title("Cuts", size(medium) color(black) height(5)) ///
graphregion(color(white)) bgcolor(white) recast(line) recastci(rarea) ci1opts(color(red) fintensity(60)) ci3opts(color(dkorange)) ///
ci2opts(color(ebblue)) ci4opts(color(lime)) ///
plot1opts(lcolor(cranberry)) plot3opts(lcolor(orange) lpattern(longdash_dot)) plot2opts(lcolor(blue)) plot4opts(lcolor(midgreen) lpattern(dash_dot)) ///
unique name("ub_lnumcut_govdef_event", replace)


